<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户水电详情</title>
    <!-- CSS 和 JavaScript 引用 -->
    <link rel="stylesheet" href="../../static/css/bootstrap.4.3.1.min.js.css" th:href="@{/css/bootstrap.4.3.1.min.js.css}"/>
    <link rel="stylesheet" href="../../static/css/layui.css" th:href="@{/css/layui.css}"/>
    <script th:src="@{/js/jquery-3.4.1.js}"></script>
    <script th:src="@{/js/layui.js}"></script>
    <script th:src="@{/js/modules/layer.js}"></script>
    <style>
        body {
            background-color: #F5F6F9;
            font-family: 'Arial', sans-serif;
        }

        .header {
            background-color: #fff;
            padding: 20px 0;
            border-bottom: 1px solid #ddd;
        }

        .header h1 {
            text-align: center;
            color: #333;
            font-size: 28px;
            margin: 0;
        }

        .container {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            margin-top: 20px;
        }

        .table {
            margin-top: 20px;
        }

        .table th, .table td {
            text-align: center;
            vertical-align: middle;
        }

        .table thead th {
            background-color: #f8f9fa;
            color: #495057;
        }

        .btn {
            margin: 5px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }

        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
        }

        .btn-danger {
            background-color: #dc3545;
            border-color: #dc3545;
        }

        a {
            color: #e6e6e6;
            text-decoration: none;
        }

        a:hover {
            color: orange;
            text-decoration: none;
        }

        li {
            width: 300px;
            display: inline;
            margin: 0px 2% 0px 0px;
        }
    </style>
</head>
<body style="background-color: #F5F6F9">
<div style="background-color: white">
    <h1 style="text-align: center">水电表</h1>
</div>
<br>
<div class="container" style="background-color: white">
    <table class="table table-striped table-bordered table-hover text-center" id="yxy123">
        <thead>
        <tr>
            <th>月份</th>
            <th>用水量</th>
            <th>用电量</th>
            <th>总费用</th>
            <th>记录日期</th>
            <th>更新日期</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="info : ${waterElectricityInfo}">
            <td th:text="${#dates.format(info.usageMonth, 'yyyy-MM')}"></td>
            <td th:text="${info.totalWaterUsage}"></td>
            <td th:text="${info.totalElectricityUsage}"></td>
            <td th:text="${info.getCost()}"></td>
            <td th:text="${info.getCreatedAt()}"></td>
            <td th:text="${info.getUpdatedAt()}"></td>
            <td>
                <button class="btn btn-primary" th:value="${info.id}" id="yy1" onclick="get5678(this.value)">更改</button>
                <button class="btn btn-danger" th:value="${info.id}"  id="yy2" onclick="del123(this.value)"  >删除</button>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<script>

    function get5678(data){
        debugger
        let baseApi1 = "/root/";
        commonMethod123.layerOpen("修改住户水电信息", baseApi1 + 'editWater?id='+data);
    }


    //删除
    function del123(data){
        let baseApi1 = "/root/";
        commonMethod111.layerOpen("删除住户水电信息", baseApi1 + 'delWater?id='+data);
    }

    var commonMethod123 = {
        layerOpen: function (title, url) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.open({
                    type: 2,
                    maxmin: true,
                    title: title,
                    shade: 0.1,
                    area: ['700px', '600px'],
                    content: url
                });
            });
        }
    }

    var commonMethod111 = {
        layerOpen: function (title, url) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.open({
                    type: 2,
                    maxmin: true,
                    title: title,
                    shade: 0.1,
                    area: ['300px', '200px'],
                    content: url
                });
            });
        }
    }


</script>
</body>
</html>